home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / zsh.vim < prev   
Encoding:
Text File  |  1999-08-10  |  4.2 KB  |  97 lines

  1. " Vim syntax file
  2. " Language:    Z shell (zsh)
  3. " Maintainer:    Felix von Leitner <leitner@math.fu-berlin.de>
  4. " Heavily based on sh.vim by Lennart Schultz
  5. " Last change:    1997 August 21
  6.  
  7. " Remove any old syntax stuff hanging around
  8. syn clear
  9.  
  10. syn region    zshSinglequote    start=+'+ skip=+\\'+ end=+'+
  11. " A bunch of useful zsh keywords
  12. " syn keyword    zshFunction    function
  13. syn keyword    zshStatement    bg break cd chdir continue echo eval exec
  14. syn keyword    zshStatement    exit export fg getopts hash jobs kill
  15. syn keyword    zshStatement    pwd read readonly return set zshift function
  16. syn keyword    zshStatement    stop suspend test times trap type ulimit
  17. syn keyword    zshStatement    umask unset wait setopt compctl . source
  18. syn keyword    zshConditional    if else esac case then elif fi in
  19. syn keyword    zshRepeat    while for do done
  20.  
  21. " Following is worth to notice: command substitution, file redirection and functions (so these features turns red)
  22. syn match    zshFunctionName    "[a-zA-Z_][a-zA-Z0-9_]*[     ]*()"
  23. syn region    zshCommandSub    start=+`+ skip=+\\`+ end=+`+
  24. " contains=ALLBUT,zshFunction
  25. syn match    zshRedir    "\d\=\(<\|<<\|>\|>>\)\(|\|&\d\)\="
  26.  
  27. syn keyword    zshTodo contained TODO
  28.  
  29. syn keyword    zshShellVariables    USER LOGNAME HOME PATH CDPATH SHELL
  30. syn keyword    zshShellVariables    LC_TYPE LC_MESSAGE MAIL MAILCHECK
  31. syn keyword    zshShellVariables    PS1 PS2 IFS EGID EUID ERRNO GID UID
  32. syn keyword    zshShellVariables    HOST LINENO MACHTYPE OLDPWD OPTARG
  33. syn keyword    zshShellVariables    OPTIND OSTYPE PPID PWD RANDOM SECONDS
  34. syn keyword    zshShellVariables    SHLVL TTY signals TTYIDLE USERNAME
  35. syn keyword    zshShellVariables    VENDOR ZSH_NAME ZSH_VERSION ARGV0
  36. syn keyword    zshShellVariables    BAUD COLUMNS cdpath DIRSTACKSIZE
  37. syn keyword    zshShellVariables    FCEDIT fignore fpath histchars HISTCHARS
  38. syn keyword    zshShellVariables    HISTFILE HISTSIZE KEYTIMEOUT LANG
  39. syn keyword    zshShellVariables    LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES
  40. syn keyword    zshShellVariables    LC_TIME LINES LISTMAX LOGCHECK mailpath
  41. syn keyword    zshShellVariables    MAILPATH MANPATH manpath module_path
  42. syn keyword    zshShellVariables    MODULE_PATH NULLCMD path POSTEDIT
  43. syn keyword    zshShellVariables    PS3 PS4 PROMPT PROMPT2 PROMPT3 PROMPT4
  44. syn keyword    zshShellVariables    psvar PSVAR prompt READNULLCMD
  45. syn keyword    zshShellVariables    REPORTTIME RPROMPT RPS1 SAVEHIST
  46. syn keyword    zshShellVariables    SPROMPT STTY TIMEFMT TMOUT TMPPREFIX
  47. syn keyword    zshShellVariables    watch WATCH WATCHFMT WORDCHARS ZDOTDIR
  48. syn match    zshSpecialShellVar    "\$[-#@*$?!0-9]"
  49. syn keyword    zshSetVariables        ignoreeof noclobber
  50. syn region    zshDerefOpr    start="\${" end="}" contains=zshShellVariables
  51. syn match    zshDerefIdentifier    "\$[a-zA-Z_][a-zA-Z0-9_]*\>"
  52. syn match    zshOperator        "[][}{&;|)(]"
  53.  
  54. " String and Character contstants
  55. " Highlight special characters (those which have a backslash) differently
  56. syn match   zshSpecial    contained "\\\d\d\d\|\\[abcfnrtv\\]"
  57.  
  58.  
  59. syn match  zshNumber        "-\=\<\d\+\>"
  60. syn match  zshComment    "#.*$" contains=zshNumber,zshTodo
  61.  
  62.  
  63. syn match zshTestOpr    "-\<[oeaznlg][tfqet]\=\>\|!\==\|-\<[b-gkLprsStuwjxOG]\>"
  64. "syn region zshTest           start="\[" skip="\\$" end="\]" contains=zshString,zshTestOpr,zshDerefIdentifier,zshDerefOpr
  65. syn region  zshString    start=+"+  skip=+\\"+  end=+"+  contains=zshSpecial,zshOperator,zshDerefIdentifier,zshDerefOpr,zshSpecialShellVar,zshSinglequote,zshCommandSub
  66.  
  67. if !exists("did_zsh_syntax_inits")
  68.   let did_zsh_syntax_inits = 1
  69.   " The default methods for highlighting.  Can be overridden later
  70.   hi link zshSinglequote        zshString
  71.   hi link zshConditional        zshStatement
  72.   hi link zshRepeat        zshStatement
  73.   hi link zshFunctionName    zshFunction
  74.   hi link zshCommandSub        zshOperator
  75.   hi link zshRedir        zshOperator
  76.   hi link zshSetVariables    zshShellVariables
  77.   hi link zshSpecialShellVar    zshShellVariables
  78.   hi link zshTestOpr        zshOperator
  79.   hi link zshDerefOpr        zshSpecial
  80.   hi link zshDerefIdentifier    zshShellVariables
  81.   hi link zshOperator        Operator
  82.   hi link zshStatement        Statement
  83.   hi link zshNumber        Number
  84.   hi link zshString        String
  85.   hi link zshComment        Comment
  86.   hi link zshSpecial        Special
  87.   hi link zshTodo        Todo
  88.   hi link zshShellVariables    Special
  89. "  hi zshOperator        term=underline ctermfg=6 guifg=Purple gui=bold
  90. "  hi zshShellVariables    term=underline ctermfg=2 guifg=SeaGreen gui=bold
  91. "  hi zshFunction        term=bold ctermbg=1 guifg=Red
  92. endif
  93.  
  94. let b:current_syntax = "zsh"
  95.  
  96. " vim: ts=8
  97.